package org.grottarossa.ui.core.actions;

import com.vaadin.ui.Button;

/**
 * Bottone Vaadin collegato ad una specifica {@link CustomAction}
 * @author 
 */
public class CustomActionButton extends Button {

	/**
	 * @param action {@link CustomAction} da eseguire al click del bottone
	 */
	public CustomActionButton(final CustomAction action)
	{
		super(action.getCaption(), new ClickListener() {
			public void buttonClick(ClickEvent event)
			{
				if (action.isEnabled(null))
					action.run(null);
			}
		});
	}
}
